//
//  YHView.m
//  Pods
//
//  Created by yanHu on 2024/4/12.
//

#import "YHView.h"
#import <Masonry/Masonry.h>

@implementation YHView
- (instancetype)init
{
    self = [super init];
    if (self) {
        NSLog(@"-------------");
        NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"YHKitResource" ofType:@"bundle"];
        NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];
        UIImage *image = [UIImage imageNamed:@"WechatIMG" inBundle:bundle compatibleWithTraitCollection:nil];
        
        UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
        [self addSubview:imageView];
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.mas_equalTo(self);
        }];
    }
    return self;
}

+ (instancetype)viewWithImage:(UIImage *)image {
    YHView *view = [[YHView alloc] init];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    [view addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(self);
    }];
    return view;
}

@end
